/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.yunhoo.pay.util;

import com.yunhoo.asset.util.PayCodeConstants;
import com.yunhoo.pay.model.Expense;
import com.yunhoo.sys.util.common.FacesUtils;
import com.yunhoo.sys.util.common.ToolKit;

/**
 *
 * @author Administrator
 */
public class BusinessToolkit {
    public static String buildPaycode(Expense exp) {
        if (!exp.getCostitem().getCode().trim().equals("")) {
            if (exp.getBudgetSource() != null) {
                if (exp.getCostClass() != null) {
                    if (!exp.getCostTypes().getCode().trim().equals("")) {
                        String pcode = PayCodeConstants.buildPayCodeForLoanBill(exp);
                        exp.setPaycode(pcode);
                    } else {
                        ToolKit.msgs_err("请选择支出渠道");
                    }
                } else {
                    ToolKit.msgs_err("请选择支出类别");
                }
            } else {
                ToolKit.msgs_err("请选择预算来源");
            }
        } else {
            ToolKit.msgs_err("请选择经济分类");
        }
        return exp.getPaycode().trim();
    }
}
